package com.droiddata;

import android.util.Log;

public class SQLiteTransactionSupport {
    private ISQLiteTransactionManager transactionManager;
    
    public SQLiteTransactionSupport() {	
    }

    public SQLiteTransactionSupport(ISQLiteTransactionManager transactionManager) {	
	this.transactionManager = transactionManager;
    }

    protected SQLiteTransactionTemplate getTransactionTemplate() {
	if(transactionManager == null) {
	    Log.e("SQLiteTransactionSupport", "A transaction manager must be supplied before attempting to create a transaction template.");
	    throw new IllegalStateException("A transaction manager must be supplied before attempting to create a transaction template.");
	}
	return new SQLiteTransactionTemplate(transactionManager); 
    }
    
    public void setTransactionManager(ISQLiteTransactionManager transactionManager) {
	this.transactionManager = transactionManager;
    }
}
